Fix CUDA build with MSVC by enabling /Zc:preprocessor for nvcc host compilation on VS 16.5 or greater - #2054
Merged
kunal-vaishnavi merged 5 commits intoMay 18, 2026
Conversation
…ompilation on MSVC version greter then 1925 (VS 16.5)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the build configuration to fix Windows CUDA builds when nvcc uses MSVC (cl.exe) as its host compiler on Visual Studio 16.5+ by enabling MSVC’s conforming preprocessor (/Zc:preprocessor) for CUDA compilation.
Changes:
- Adds an MSVC version gate (
MSVC_VERSION >= 1925) to pass-Xcompiler=/Zc:preprocessorduring CUDA compilation.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
Thanks for your contribution! Can you sync with the main branch to get the latest CI fixes? |
added 2 commits
May 12, 2026 20:11
…n-16.5-due-missing-flag
…missing-flag' of https://github.com/nsubaru/onnxruntime-genai into fix/msvc-build-failure-on-version-greter-then-16.5-due-missing-flag
Contributor
|
PRs have been recently made to improve the Windows CUDA CI pipeline. Can you sync with main to receive those fixes? |
kunal-vaishnavi
approved these changes
May 14, 2026
…n-16.5-due-missing-flag
kunal-vaishnavi
enabled auto-merge (squash)
May 15, 2026 17:30
kunal-vaishnavi
disabled auto-merge
May 18, 2026 08:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes CUDA builds on Windows when nvcc uses MSVC as the host compiler on Visual Studio 16.5 or greater
Problem
Recent CUDA/CCCL headers require MSVC's conforming preprocessor. Without passing
/Zc:preprocessorto the host compiler, CUDA compilation can fail with an errorfrom
cuda/std/__cccl/preprocessor.h.Solution
Pass
/Zc:preprocessorto MSVC version check through nvcc for CUDA source compilation onWindows/MSVC builds.
Testing
-Xcompiler=/Zc:preprocessor